﻿@model IEnumerable<TCC.CMFlow.Models.LogSistema>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="panel panel-info" style="margin-top: 15px">
    <div class="panel-heading clearfix">
        <h3 class="panel-title pull-left"><strong>Log do Sistema</strong></h3>
    </div>
    <div class="panel-body">
        @using (Html.BeginForm("Search", "LogSistema", FormMethod.Post))
        {
            <div class="panel panel-default">
                <div class="panel-body">
                    <div class="form-inline">
                        <div class="form-group">
                            @Html.Label("ID")
                            @Html.TextBox("ID", null, new { @class = "search-control", style = "width:75px;" })
                        </div>
                        <div class="form-group">
                            @Html.Label("Módulo")
                            @Html.DropDownList("ModuloLog", ViewBag.ModuloLog as SelectList, "Todos", new { @class = "chzn-select", style = "width:200px;" })
                        </div>
                        <div class="form-group">
                            @Html.Label("Ação de")
                            @Html.TextBox("acaoDe", null, new { @class = "search-control", type = "date" })
                        </div>
                        <div class="form-group">
                            @Html.Label("até")
                            @Html.TextBox("acaoAte", null, new { @class = "search-control", type = "date" })
                        </div>
                    </div>
                </div>
                <div class="panel-footer clearfix">
                    <div class="pull-right">
                        <input type="submit" value="Pesquisar" class="btn btn-primary btn-sm" />
                        <input type="reset" value="Limpar campos" class="btn btn-default btn-sm" />
                    </div>
                </div>
            </div>
        }

        @if(Model == null || Model.Count() == 0)
        {
            <div class="alert alert-warning">
                <center>Nenhum registro!</center>
            </div>
        }
        else
        {
            <table class="table table-striped table-bordered">
                <tr>
                    <th>
                        @Html.DisplayNameFor(model => model.ID)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.TipoLog)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.Usuario.Nome)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.NomeEstacao)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.DataHoraAcao)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.Modulo.Nome)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.Mensagem)
                    </th>
                </tr>

                @foreach (var item in Model)
                {
                    <tr>
                        <td>
                            @Html.DisplayFor(modelItem => item.ID)
                        </td>
                        <td>
                            @Html.Action("TipoLog", new { tipoLog = item.TipoLog })
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.Usuario.Nome)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.NomeEstacao)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.DataHoraAcao)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.Modulo.Nome)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.Mensagem)
                        </td>
                    </tr>
                }
            </table>
        }
    </div>
</div>

<script src="/TCC.CMFlow/Scripts/jquery-1.10.2.js"></script>
<script src="~/Scripts/chosen.jquery.js" type="text/javascript"></script>
<script> $(".chzn-select").chosen(); </script>
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/modalform")
}